package com.restaurant.application.indexes.signinlist.support;

import com.google.common.collect.Lists;
import com.nebutown.generation.Convert;
import com.nebutown.generation.PickableBean;
import java.lang.Integer;
import java.util.List;

public class SignInListData implements PickableBean {
    
    public static final String FN_SIGNINSCORE = "signInScore";
    
    public static final List<String> FIELD_NAMES = Lists.newArrayList(
             FN_SIGNINSCORE);
    
    private Integer signInScore;
    
    public SignInListData(Integer signInScore) {
        setSignInScore(signInScore);
    }
    
    public SignInListData() {
    }
    
    public SignInListData duplicate() {
        SignInListData result = new SignInListData();
        result.signInScore = this.signInScore;
        return result;
    }
    
    @Override
    public String toString() {
        return Convert.toJson(this);
    }
    
    public Integer getSignInScore() {
        return signInScore;
    }
    
    public void  setSignInScore(Integer value) {
        this.signInScore = value;
    }
    
    public SignInListData withSignInScore(Integer value) {
        setSignInScore(value);
        return this;
    }
    
    public SignInListData withSignInScore(Integer value, Integer defaultValue) {
        setSignInScore(value == null ? defaultValue : value);
        return this;
    }
    
    public Object getValueOf(String name) {
        switch(name) {
        case "signInScore": return getSignInScore();
        }
        return null;
    }
    
    public boolean hasField(String name) {
        return FIELD_NAMES.contains(name);
    }
    
    @Override
    public int hashCode() {
        return signature().hashCode();
    }
    
    @Override
    public boolean equals(Object o) {
        if(!(o instanceof SignInListData)) return false;
        return signature().equals(((SignInListData)o).signature());
    }
    
    public String signature() {
        throw new RuntimeException("Bean SignInListData has no signature defined, no hash code or equals possible.");
    }
}
